From eadc1aebe3b911f122c2567b76e2a943cd28c28f Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Mon, 1 May 2017 16:54:17 +0200 Subject: [PATCH] Many updates, bringing in some changes from Ubuntu --- debian/README.source | 8 +- debian/bootstrap.py | 4 + debian/cargo-vendor-unpack.py | 32 ------- debian/changelog | 14 +++ debian/control | 4 +- debian/copyright | 88 +++++++++---------- debian/gbp.conf | 4 +- debian/make_orig_multi.sh | 29 +++--- debian/rules | 30 +++---- ...l-filter.txt => vendor-tarball-filter.txt} | 4 +- ...us.txt => vendor-tarball-unsuspicious.txt} | 0 11 files changed, 96 insertions(+), 121 deletions(-) delete mode 100755 debian/cargo-vendor-unpack.py rename debian/{deps-tarball-filter.txt => vendor-tarball-filter.txt} (78%) rename debian/{deps-tarball-unsuspicious.txt => vendor-tarball-unsuspicious.txt} (100%) diff --git a/debian/README.source b/debian/README.source index 9cc1e9556..45757393d 100644 --- a/debian/README.source +++ b/debian/README.source @@ -2,7 +2,7 @@ Updating the package ==================== 1. Run d/make_orig_multi.sh . -2. Verify the -deps component tarball to make sure it looks good. +2. Verify the -vendor component tarball to make sure it looks good. If not, edit d/make_orig_multi.sh and the surrounding files (such as patches and exclude files) and repeat the above until it looks good. 3. $ git fetch upstream @@ -10,8 +10,8 @@ Updating the package $ git remote add upstream https://github.com/rust-lang/cargo 4. $ gbp import-orig ../cargo_.orig.tar.gz If you get errors, check the extra default flags in d/gbp.conf -5. Check that no old versions remain in deps/. If there are, then your git repo - was messed up when you ran (4). Rewind the debian/sid, upstream, and +5. Check that no old versions remain in vendor/. If there are, then your git + repo was messed up when you ran (4). Rewind the debian/sid, upstream, and pristine-tar branches, delete the upstream/ tag; this reverts step (4). Clean up your git repo, and then try (4) again. 6. Update d/patches and the rest of the packaging, as normal. @@ -38,7 +38,7 @@ This package currently resort to several workarounds to build cargo: As such, the original source is composed by two tarballs: * cargo source - * dependencies crates (under deps/), stripped of unused embedded + * dependencies crates (under vendor/), stripped of unused embedded C libraries -- Luca Bruno Sat, 13 Feb 2016 17:50:59 +0100 diff --git a/debian/bootstrap.py b/debian/bootstrap.py index e09ee2677..fafd95876 100755 --- a/debian/bootstrap.py +++ b/debian/bootstrap.py @@ -1,5 +1,9 @@ #!/usr/bin/env python """ +NOTE: This script has not been used for a very long time and very likely won't +work. Please read the code before attempting to run it and hoping that "just +fixing the errors" will work. -- infinity0 + About ===== diff --git a/debian/cargo-vendor-unpack.py b/debian/cargo-vendor-unpack.py deleted file mode 100755 index 1ab1406ce..000000000 --- a/debian/cargo-vendor-unpack.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright: 2015 The Debian Project -# License: MIT-License or Apache-2.0 -# -# Helper to unpack a local crate registry to original sources -# TODO: rewrite to perl and add to dh-cargo, maybe? - -import os -import tarfile - -def main(): - curdir = os.getcwd() - depsdir = os.path.join(curdir, "deps") - vendordir = os.path.join(curdir, "vendor") - cachedir = os.path.join(vendordir, "cache") - if not os.path.exists(depsdir): - os.makedirs(depsdir) - - for _, names, _ in os.walk(top=cachedir): - for cratename in names: - for _, vers, _ in os.walk(top=os.path.join(cachedir, cratename)): - for cratever in vers: - crate = os.path.join(cachedir, cratename, cratever, "download") - tar = tarfile.open(crate) - tar.extractall(path=depsdir) - print("Unpacking crate deps %s" % crate) - tar.close() - - -if __name__ == "__main__": - main() diff --git a/debian/changelog b/debian/changelog index 69b2f807f..c13ab6302 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +cargo (0.17.0-1~exp2) UNRELEASED; urgency=medium + + * Bring in some changes from Ubuntu. + - Rename deps/ to vendor/ as that's what upstream uses, and update + other files with the new paths too. + - Remove cargo-vendor-unpack since we no longer need to postprocess + cargo-vendor output in that way. + * Document that bootstrap.py probably doesn't work now. + * Include /usr/share/rustc/architecture.mk in d/rules instead of duplicating + awkward arch-dependent Makefile snippets. + * Don't embed libgit2, add a versioned B-D to libgit2-dev. + + -- Ximin Luo Mon, 01 May 2017 16:38:43 +0200 + cargo (0.17.0-1~exp1) experimental; urgency=medium * New upstream release. (Closes: #851089, #859312) diff --git a/debian/control b/debian/control index 0aa8c2e1a..05612b4cd 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Uploaders: Luca Bruno , Priority: extra Build-Depends: debhelper (>= 9.20141010), dpkg-dev (>= 1.17.14), - rustc (>= 1.13), + rustc (>= 1.16), pkg-config, cmake, cargo (>= 0.7.0) , @@ -17,7 +17,7 @@ Build-Depends: debhelper (>= 9.20141010), bash-completion, libcurl4-gnutls-dev | libcurl4-openssl-dev, libssh2-1-dev, - libgit2-dev, + libgit2-dev (>= 0.25.1), libhttp-parser-dev, libssl-dev, zlib1g-dev diff --git a/debian/copyright b/debian/copyright index 346a5d72f..970cf3c03 100644 --- a/debian/copyright +++ b/debian/copyright @@ -13,18 +13,18 @@ Comment: notice may not be copied, modified, or distributed except according to those terms. -Files: deps/* - deps/time-* - deps/libc-* - deps/bitflags-* - deps/semver-* - deps/log-* - deps/glob-* - deps/env_logger-* - deps/rustc-* - deps/term-* - deps/rustc-serialize-* - deps/regex-* +Files: vendor/* + vendor/time-* + vendor/libc-* + vendor/bitflags-* + vendor/semver-* + vendor/log-* + vendor/glob-* + vendor/env_logger-* + vendor/rustc-* + vendor/term-* + vendor/rustc-serialize-* + vendor/regex-* Copyright: 2014-2015 The Rust Project Developers License: MIT-License or Apache-2.0 Comment: @@ -33,36 +33,36 @@ Comment: same MIT/Apache-2.0 dual-license. See https://github.com/rust-lang. Exceptions are noted below. -Files: deps/advapi32-sys-* - deps/kernel32-* - deps/winapi-* +Files: vendor/advapi32-sys-* + vendor/kernel32-* + vendor/winapi-* Copyright: 2015 Peter Atashian License: MIT-License Comment: see https://github.com/retep998/winapi-rs -Files: deps/url-* +Files: vendor/url-* Copyright: 2015 Simon Sapin License: MIT-License or Apache-2.0 Comment: see https://github.com/servo/rust-url -Files: deps/matches-* +Files: vendor/matches-* Copyright: 2015 Simon Sapin License: MIT-License Comment: see https://github.com/SimonSapin/rust-std-candidates -Files: deps/num_cpus-* +Files: vendor/num_cpus-* Copyright: 2015 Sean McArthur License: MIT-License Comment: see https://github.com/seanmonstar/num_cpus -Files: deps/strsim-* +Files: vendor/strsim-* Copyright: 2015 Danny Guo License: MIT-License Comment: see https://github.com/dguo/strsim-rs -Files: deps/memchr-* - deps/aho-corasick-* - deps/docopt-* +Files: vendor/memchr-* + vendor/aho-corasick-* + vendor/docopt-* Copyright: 2015 Andrew Gallant License: MIT-License or Unlicense Comment: see upstream projects, @@ -70,59 +70,59 @@ Comment: see upstream projects, * https://github.com/BurntSushi/aho-corasick * https://github.com/docopt/docopt.rs -Files: deps/openssl-sys-* +Files: vendor/openssl-sys-* Copyright: 2015 Alex Crichton 2015 Steven Fackler License: MIT-License Comment: see https://github.com/sfackler/rust-openssl -Files: deps/libz-sys-* - deps/libgit2-sys-* - deps/libssh2-sys-* - deps/miniz-sys-* - deps/gcc-* - deps/git2-* - deps/git2-curl-* - deps/filetime-* - deps/flate2-* - deps/pkg-config-* - deps/toml-* - deps/tar-* +Files: vendor/libz-sys-* + vendor/libgit2-sys-* + vendor/libssh2-sys-* + vendor/miniz-sys-* + vendor/gcc-* + vendor/git2-* + vendor/git2-curl-* + vendor/filetime-* + vendor/flate2-* + vendor/pkg-config-* + vendor/toml-* + vendor/tar-* Copyright: 2014-2015 Alex Crichton License: MIT-License or Apache-2.0 Comment: see https://github.com/alexcrichton/ -Files: deps/miniz-sys-*/miniz.c +Files: vendor/miniz-sys-*/miniz.c Copyright: Rich Geldreich License: Unlicense -Files: deps/libgit2-sys-*/libgit2/* +Files: vendor/libgit2-sys-*/libgit2/* Copyright: 2009-2012, the libgit2 contributors License: GPL-2 with linking exception -Files: deps/libgit2-sys-*/libgit2/cmake/Modules/FindGSSAPI.cmake +Files: vendor/libgit2-sys-*/libgit2/cmake/Modules/FindGSSAPI.cmake Copyright: 2013, Andreas Schneider License: BSD-2-clause -Files: deps/libgit2-sys-*/libgit2/include/git2/inttypes.h - deps/libgit2-sys-*/libgit2/include/git2/stdint.h +Files: vendor/libgit2-sys-*/libgit2/include/git2/inttypes.h + vendor/libgit2-sys-*/libgit2/include/git2/stdint.h Copyright: 2006, Alexander Chemeris License: BSD-3-clause -Files: deps/libgit2-sys-*/libgit2/src/khash.h +Files: vendor/libgit2-sys-*/libgit2/src/khash.h Copyright: 2008, 2009, 2011, Attractive Chaos License: MIT-License -Files: deps/libgit2-sys-*/libgit2/src/xdiff/* +Files: vendor/libgit2-sys-*/libgit2/src/xdiff/* Copyright: 2003-2006, Davide Libenzi 2003-2006, Johannes E. Schindelin License: LGPL-2.1+ -Files: deps/libgit2-sys-*/libgit2/src/xdiff/xhistogram.c +Files: vendor/libgit2-sys-*/libgit2/src/xdiff/xhistogram.c Copyright: 2010, Google Inc and others from JGit's IP log. License: EDL-1.0 -Files: deps/libgit2-sys-*/libgit2/src/date.c +Files: vendor/libgit2-sys-*/libgit2/src/date.c Copyright: 2005, Linus Torvalds License: GPL-2 with linking exception diff --git a/debian/gbp.conf b/debian/gbp.conf index cbdd2d060..4034a8d09 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -3,11 +3,11 @@ upstream-tag = upstream/%(version)s debian-tag = debian/%(version)s pristine-tar = True upstream-branch = upstream -debian-branch = debian/sid [buildpackage] submodules = True [import-orig] upstream-vcs-tag = %(version)s -component = deps +component = vendor +debian-branch = debian/experimental diff --git a/debian/make_orig_multi.sh b/debian/make_orig_multi.sh index 040b0c62d..ddd3073a8 100755 --- a/debian/make_orig_multi.sh +++ b/debian/make_orig_multi.sh @@ -24,8 +24,8 @@ if [ -z "$1" ] fi; BOOTSTRAP_PY=$(find "${PWD}" -name bootstrap.py -type f) -DEPS_FILTER=$(find "${PWD}" -name deps-tarball-filter.txt -type f) -DEPS_SUS_WHITELIST=$(find "${PWD}" -name deps-tarball-unsuspicious.txt -type f) +VENDOR_FILTER=$(find "${PWD}" -name vendor-tarball-filter.txt -type f) +VENDOR_SUS_WHITELIST=$(find "${PWD}" -name vendor-tarball-unsuspicious.txt -type f) # Download cargo tarball uscan --rename ${USCAN_ARGS} --force-download --destdir "${TMPDIR}/" @@ -46,36 +46,35 @@ export GIT_AUTHOR_NAME="deb-build" export GIT_AUTHOR_EMAIL="<>" export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}" export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}" -cargo vendor --explicit-version --verbose deps +cargo vendor --explicit-version --verbose -# Unpack artifacts and clean embedded libs -${WORKDIR}/debian/cargo-vendor-unpack.py -grep -v '^#' ${DEPS_FILTER} | xargs -I% sh -c 'rm -rf deps/%' -for i in deps/*; do ${WORKDIR}/debian/cargo-checksums-prune.py "$i"; done +# Clean embedded libs and update checksums +grep -v '^#' ${VENDOR_FILTER} | xargs -I% sh -c 'rm -rf vendor/%' +for i in vendor/*; do ${WORKDIR}/debian/cargo-checksums-prune.py "$i"; done # Report any suspicious files -cp -R deps deps-scan -grep -v '^#' ${DEPS_SUS_WHITELIST} | xargs -I% sh -c 'rm -rf deps-scan/%' +cp -R vendor vendor-scan +grep -v '^#' ${VENDOR_SUS_WHITELIST} | xargs -I% sh -c 'rm -rf vendor-scan/%' echo "Checking for suspicious files..." # The following shell snippet is a bit more strict than suspicious-source(1) -find deps-scan -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \ +find vendor-scan -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \ sed -e 's/\btext\b\(.*\), with very long lines/verylongtext\1/g' | \ grep -v '\b\(text\|empty\)\b' || true echo "The above files (if any) seem suspicious, please audit them." -echo "If good, add them to ${DEPS_SUS_WHITELIST}." -echo "If bad, add them to ${DEPS_FILTER}." -rm -rf deps-scan +echo "If good, add them to ${VENDOR_SUS_WHITELIST}." +echo "If bad, add them to ${VENDOR_FILTER}." +rm -rf vendor-scan # Pack it up, reproducibly GZIP=-9n tar --sort=name \ --mtime="./Cargo.lock" \ --owner=root --group=root \ - -czf "${TMPDIR}/cargo_${CARGO_VER}.orig-deps.tar.gz" deps + -czf "${TMPDIR}/cargo_${CARGO_VER}.orig-vendor.tar.gz" vendor # All is good, we are done! echo "Your files are available at:" echo "${TMPDIR}/cargo_${CARGO_VER}.orig.tar.gz \\" -echo "${TMPDIR}/cargo_${CARGO_VER}.orig-deps.tar.gz" +echo "${TMPDIR}/cargo_${CARGO_VER}.orig-vendor.tar.gz" echo "" echo "Unpacked cargo sources are available under:" echo "${TMPDIR}/cargo/" diff --git a/debian/rules b/debian/rules index fa16496ae..5b797c601 100755 --- a/debian/rules +++ b/debian/rules @@ -3,42 +3,39 @@ include /usr/share/dpkg/pkg-info.mk include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/buildflags.mk +include /usr/share/rustc/architecture.mk + RUSTFLAGS += $(foreach flag,$(LDFLAGS),-C link-arg=$(flag)) export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS -rust_cpu = $(subst i586,i686,$(1)) -DEB_HOST_RUST_TYPE := $(call rust_cpu,$(DEB_HOST_GNU_CPU))-unknown-$(DEB_HOST_GNU_SYSTEM) -DEB_TARGET_RUST_TYPE := $(call rust_cpu,$(DEB_TARGET_GNU_CPU))-unknown-$(DEB_TARGET_GNU_SYSTEM) - # Cargo looks for config in and writes cache to $CARGO_HOME/ export CARGO_HOME = $(CURDIR)/debian/cargohome # Ask cargo to be verbose when building export VERBOSE = 1 -DEB_DESTDIR := $(CURDIR)/debian/tmp -VENDORDIR := $(CURDIR)/vendor -INDEXDIR := $(CURDIR)/vendor/index -DEPSDIR := $(CURDIR)/deps - %: dh $@ --with bash-completion override_dh_auto_configure: cp -a $(CURDIR)/Cargo.lock $(CURDIR)/.Cargo.lock.orig ifneq ($(filter pkg.cargo.mkstage0,$(DEB_BUILD_PROFILES)),) + # NOTE: this very likely doesn't work any more, see bootstrap.py for details + # Instead, you can try to bootstrap by setting PATH to a binary cargo + # downloaded from upstream, or by (TODO) cross-compiling. + # Preserved in case someone wants to resurrect it later: # Bootstrap cargo stage0 ./debian/bootstrap.py \ --no-clean \ --no-clone \ --no-git \ --no-download \ - --crate-index $(INDEXDIR)/ \ + --crate-index $(CURDIR)/vendor/index / \ --cargo-root $(CURDIR)/ \ - --target-dir $(DEPSDIR)/ \ + --target-dir $(CURDIR)/deps \ --host=$(DEB_HOST_RUST_TYPE) \ --target=$(DEB_TARGET_RUST_TYPE) # Workaround for https://github.com/rust-lang/cargo/issues/1423 - ln -s `find $(DEPSDIR) -name 'cargo-*' -type f -executable` $(CURDIR)/cargo-stage0 + ln -s `find $(CURDIR)/deps -name 'cargo-*' -type f -executable` $(CURDIR)/cargo-stage0 else ln -s `which cargo` $(CURDIR)/cargo-stage0 endif @@ -69,14 +66,9 @@ override_dh_auto_test: override_dh_auto_clean: -mv $(CURDIR)/.Cargo.lock.orig $(CURDIR)/Cargo.lock dh_auto_clean - -$(RM) -r $(CURDIR)/deps/*.rlib \ - $(CURDIR)/deps/build_script* \ - $(CURDIR)/deps/cargo* \ - $(CURDIR)/deps/*.o \ - $(CURDIR)/target/ \ + -$(RM) -r $(CURDIR)/target/ \ $(CURDIR)/.cargo \ $(CURDIR)/config.mk \ $(CURDIR)/config.stamp \ $(CURDIR)/Makefile \ - $(CURDIR)/cargo-stage0 \ - $(VENDORDIR) + $(CURDIR)/cargo-stage0 diff --git a/debian/deps-tarball-filter.txt b/debian/vendor-tarball-filter.txt similarity index 78% rename from debian/deps-tarball-filter.txt rename to debian/vendor-tarball-filter.txt index 866af0016..c5881001e 100644 --- a/debian/deps-tarball-filter.txt +++ b/debian/vendor-tarball-filter.txt @@ -1,9 +1,7 @@ # This is a list of files and dirs that should be filtered from # deps tarball for copyright/duplication reasons curl-sys-*/curl/ -libgit2-sys-*/libgit2/deps/ -libgit2-sys-*/libgit2/examples/ -libgit2-sys-*/libgit2/tests/ +libgit2-sys-*/libgit2*/ libssh2-sys-*/libssh2*/ libz-sys-*/src/zlib-*/ strsim-*/docs/ diff --git a/debian/deps-tarball-unsuspicious.txt b/debian/vendor-tarball-unsuspicious.txt similarity index 100% rename from debian/deps-tarball-unsuspicious.txt rename to debian/vendor-tarball-unsuspicious.txt -- 2.30.2